package com.baseDemo.web.dao.addresslist.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Repository;

import com.baseDemo.web.dao.addresslist.AddressListEntityDao;
import com.baseDemo.web.entity.AddressListEntity;
import com.share.hibernate.baseDaoSupport.impl.BaseDaoHibernateSupport;
@Repository
public class AddressListEntityDaoHibernate extends BaseDaoHibernateSupport<AddressListEntity> implements AddressListEntityDao{
	private static Map<String, Object> paramMap = new HashMap<String, Object>();
	@Override
	public Integer getPageTotal(String userid) {
		String HQL = " SELECT COUNT(id) FROM AddressListEntity as AE where AE.user.id=:userid";
		paramMap.clear();
		paramMap.put("userid", userid);
		return this.getAgg(HQL,paramMap);
	}
	@Override
	public List<AddressListEntity> findbyUser(Integer start, Integer limit,String userid) {
		String HQL = " FROM AddressListEntity as AE where AE.user.id=:userid";
		paramMap.clear();
		paramMap.put("userid", userid);
		return this.find(HQL, limit, start, paramMap);
	}

}
